//
//  TGAdvertCollectionViewCell.m
//  WanCaiC8
//
//  Created by QiuXun on 2019/1/21.
//  Copyright © 2019 tangang. All rights reserved.
//

#import "TGAdvertCollectionViewCell.h"

@interface TGAdvertCollectionViewCell ()

@property(nonatomic,strong)AdvertisingView *advertisingView;
@end
@implementation TGAdvertCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    self.advertisingView  = [[AdvertisingView alloc] init];
    [self.contentView addSubview:self.advertisingView];
    
    [self.advertisingView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, 10, 5, 10));
    }];
    
}

-(void)setDataArr:(NSMutableArray<AdvertisingModel *> *)dataArr{
    
    if (dataArr.count == 0) {return;}
    
    self.advertisingView.dataArr = dataArr;
    
    
    [self.advertisingView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(200);
    }];
    
}

@end
